import React from "react"
import { View } from "react-native-ui-lib"
import BasePage from "./BasePage"
import { inject, observer } from "mobx-react"
import UpgradeDialog from "./common/UpgradeDialog"
import HotUpgradeDialog from "./common/HotUpgradeDialog"
import { StyleSheet } from "react-native"

/**
 * 升级
 */
@inject("upgradeStore")
@observer
export default class Upgrade extends BasePage {

  render() {
    const { versionInfo, showUpgrade, updateInfo } = this.props.upgradeStore
    return (
      <View style={StyleSheet.absoluteFill} pointerEvents={"box-none"}>
        {
          showUpgrade ?
            <UpgradeDialog versionInfo={versionInfo}/>
            : null
        }
        {
          updateInfo ?
            <HotUpgradeDialog updateInfo={updateInfo} callback={() => this.props.upgradeStore.setValue("updateInfo", null)}/>
            : null
        }
      </View>
    )
  }
}
